package com.ruoyi.web.controller.minio;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 构建配置类
 *
 * @author tzx
 */
@Configuration
@Data
public class MinioConfiguration {
    /**
     * 用户名
     */
    private String accessKey = "minio";
    /**
     * 密码
     */
    private String secretKey = "minio@123";
    /**
     * Minio 服务端 api地址
     */
//    private String url = "http://10.52.3.63:9000";
    private String url = "http://47.100.189.93:9000";
//    private String url = "http://127.0.0.1:9000";
    /**
     * 存储桶名字
     */
    private String bucketName = "admin";

    /**
     * 构建 操作Minio的客户端
     *
     * @return
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
//            .endpoint("http://10.52.3.63:9000")
            .endpoint("http://47.100.189.93:9000")
//            .endpoint("http://127.0.0.1:9000")
            .credentials("minio", "minio@123")
            .build();
    }

}
